package com.dg.exception;

import com.dg.common.ServerResponse;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalException {

    @ExceptionHandler(ParamException.class)
        public ServerResponse handler(ParamException e){
        e.printStackTrace();
        return ServerResponse.createByError(e.getMessage());
    }

    @ExceptionHandler
    public ServerResponse handler(Exception e) {
        e.printStackTrace();
        return ServerResponse.createByError("未知错误");
    }


}
